fix(workspaces-overview): show configured-host buckets even when empty#45
Merged
Conversation
The npm version in package.json was bumped to 0.7.1 in f8976da but the lock file was left at 0.7.0. Running 'npm install' brings the lock file back in sync.
…hen empty The overview pre-creates a bucket for every configured host so that a device the user has set up shows in the overview the moment it's added — the comment at the bucket-build step says exactly that. But the final filter pass on the bucket list then stripped any bucket whose `items.length` and `totalCount` were both zero, which silently contradicted that intent. A device the user just added (or had configured for ages but never landed a workspace on) was invisible until the first workspace pushed to it bumped totalCount above zero. That's why the only known workaround was "push any workspace to it" — the push made the bucket non-empty. The fix carves out configured-host buckets (those carrying a local host row id) from the empty-bucket filter. The local 'This device' bucket and orphan buckets (workspaces referencing an unknown host_server_id) still follow the items/totalCount rule, so the overview doesn't render a dangling 'This device' row for a brand-new account with zero rows. Adds a regression test that fails on the old filter and passes on the new one.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Why this bug existed
The bucket pipeline pre-creates a bucket for every configured host (lines 303–315) — the comment there explicitly states this is so empty configured hosts still show up. But the final
.filter()six lines later required a non-zero items.length OR totalCount, silently undoing the intent. The push-workspace flow worked around it because pushing made totalCount non-zero.Test plan
npm run test— 1767 tests pass (was 1766; +1 regression test)cargo check --manifest-path src-tauri/Cargo.toml— cleanshows a configured host's bucket even when no workspaces live on it yet) fails on the unfixed component, passes on the fixed one — verified bygit stash-ing the fix and re-runningWhat's not in this PR
While investigating I noticed
hosts_bootstrap_installis the only host-write command that doesn't trigger a hosts sync. That's a real but unrelated edge case (host added while signed out → row stays dirty + server_id null → device hidden for a different reason). Worth fixing in a follow-up, but not the cause of the reported issue, so it's out of scope here.